A centralized database stores and maintains data in one single database (e.g., database server) at one location. This location is often a central computer, for example, a server computer, a computer in a cloud service, or a mainframe computer. Information stored on a centralized database is typically accessible from multiple different points. Multiple users or client workstations can work simultaneously on the centralized database, for example, based on a client/server configuration. Because of its single location, a centralized database is easy to manage, maintain, and control, especially for purposes of security. Within a centralized database data integrity is maximized and data redundancy is minimized as a single storing place of all data also implies that a given set of data only has one primary record. This aids in the maintaining of data as accurate and as consistent as possible and enhances data reliability.
However, a centralized database suffers from significant drawbacks. For example, a centralized database has a single point of failure. In particular, if there is no fault-tolerance setup and a hardware failure occurs, all data within the database is lost and work of all users is interrupted. In addition, a centralized database is highly dependent on network connectivity. As a result, the slower the Internet connection, the longer the amount of time needed for each database access. Another drawback is that bottlenecks occur when the centralized database experiences of high traffic due to the single location. Furthermore, a centralized database provides limited access to data because only one copy of the data is maintained by the database. As a result, multiple users may not be able to access the same piece of data at the same time without creating problems such as overwriting stored data. Furthermore, because a central database system has minimal to no data redundancy, if a set of data is unexpectedly lost it is difficult to retrieve it other than through manual operation from back-up disk storage.
A decentralized database such as a blockchain system provides a storage system capable of addressing the drawbacks of a centralized database. In a blockchain system, each of multiple peer nodes store a replica of the identical ledger as a distributed ledger, often called a blockchain. Clients interact with peer nodes to gain access to the blockchain. The peer nodes may be controlled by different entities having different interests and therefore are not trusting entities with respect to one another. Furthermore, there is no central authority in a blockchain. Therefore, in order for data to be added to or changed on the distributed ledger in a trusted manner, a consensus of peer nodes must occur. The consensus provides a way for trust to be achieved in a blockchain system of untrusting peer nodes.
To conduct exchanges or otherwise store data via the blockchain, a client may submit a request (e.g., a transaction, etc.) to a peer node. The requests should be processed and recorded in the blockchain in the order they are submitted, but it is difficult to ensure a fair ordering because there is no mechanism to agree on the time across multiple nodes as the system clock of nodes may not be fully synchronized each other, and there are network latencies between the nodes. In addition, since nodes belong to different entities that may not behave honestly with respect to each other, each node may try to gain an advantage/benefit by ordering their own requests earlier than others.
For example, in financial markets, the time priority and the price priority are the principle for fair trades. The time priority is one of the rules for processing sell order and buy orders at a Stock Exchange. It means that when multiple orders are placed for the same equity at the same price, the sell/buy orders placed earlier shall be matched with the corresponding sell/buy order, and executed as a trade. If the matching of the sell/buy orders are processed by a centralized system, then the system can sequentially process each order to respect the time priority. However, in a decentralized system, orders may be processed by multiple systems in parallel, during which the sequence of orders may not be correctly controlled. Inability to ensure the correct ordering will cause unfairness that is not acceptable in the market practice.
The request includes a timestamp which indicates the time the request was submitted by the front-end application. The timestamp should be used as a basis for ordering the request among multiple requests. When used properly, a timestamp ensures that fairness is provided to the transaction when multiple transactions interact with the same resource. However, a blockchain is subject to fraud. For example, an application node can be hijacked, or completely replaced. Such an application behave dishonestly and put a timestamp that is earlier than the real timestamp, so that the request can be ordered earlier than the requests submitted by applications that belong to other entities. As another example, a peer node may deliberately neglect and delay the consensus making process of requests from other entities so that those requests will be ordered later than its own entity's requests. Accordingly, what is needed is a time management mechanism within a blockchain that ensures trust and prevents fraudulent activity within the blockchain network.